/* main.c */
#define GPMCON		*((volatile unsigned int *)0x7F008820)
#define GPMDAT		*((volatile unsigned int *)0x7F008824)

void delay(volatile unsigned int t)
{
	volatile unsigned int t2 = 0xFFFF;
	while (t--)
		for (; t2; t2--);
}

int main(void)
{
	int toggle = 0;
	//GPMCON &= ~(0xFF << 12);
	GPMCON |= (0x1<<0) | (0x01<<4) | (0x01<<8) | (0x01<<12);			// 配置GPM0~3为输出
	
	while (1)
	{
		GPMDAT |= 0x0F;		// 熄灭LED1~4
		
		GPMDAT &= ~(0x01<<toggle);	//依次点亮LED1~4
		
		toggle = (++toggle)%3;
		delay(0x50000);
	}
	
	return 0;
}

